package com.gnerv.plug.comment.action;

import com.gnerv.plug.comment.model.CommentInfo;
import com.gnerv.plug.constant.EmbraceSourceInfo;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ui.Messages;

import javax.swing.*;

public class SetAuthor extends AnAction {

    public SetAuthor() {
        super();
    }
    public SetAuthor(String text, String description, Icon icon) {
        super(text, description, icon);
    }

    @Override
    public void actionPerformed(AnActionEvent event) {
        PropertiesComponent instance = PropertiesComponent.getInstance();
        String author = Messages.showInputDialog(EmbraceSourceInfo.NAME, "Author", Messages.getQuestionIcon());
        instance.setValue(EmbraceSourceInfo.COMMENT_AUTHOR, author);
    }
}